Tx

class Tx(connection: Connection, closeConnectionAfterTx: Boolean) : Transaction(source)

Represents a database transaction that uses a reactive connection for transactional operations.

This class implements the Transaction interface and provides functionality to manage the lifecycle of a transaction, including committing, rolling back, and executing SQL statements. It ensures thread-safety and consistency using a coroutine-based mutex to synchronize operations on the transaction.

Parameters

connection

The reactive database connection used for the transaction.

closeConnectionAfterTx

Indicates whether the connection should be closed after the transaction is finalized.

Constructors

Link copied to clipboard
constructor(connection: Connection, closeConnectionAfterTx: Boolean)

Creates a new transaction instance with a specific database connection.

Properties

Link copied to clipboard
open override val status: Transaction.Status

Functions

Link copied to clipboard
open fun assertIsOpen()
Link copied to clipboard
open suspend override fun commit(): Result<Unit>
Link copied to clipboard
open suspend override fun execute(statement: Statement): Result<Long>
open suspend override fun execute(sql: String): Result<Long>
Link copied to clipboard
open suspend fun <T> fetchAll(sql: String, rowMapper: RowMapper<T>): Result<List<T>>
open suspend override fun fetchAll(statement: Statement): Result<ResultSet>
open suspend override fun fetchAll(sql: String): Result<ResultSet>
open suspend override fun <T> fetchAll(statement: Statement, rowMapper: RowMapper<T>): Result<List<T>>
Link copied to clipboard
open suspend override fun rollback(): Result<Unit>